﻿using AutoRegistDependency.Attributes;
using HandyControl.Controls;
using HandyWpf.ViewModels.Sys;
using Models.Entities.SystemEntities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HandyWpf.Views.Sys.Dictionary
{
    /// <summary>
    /// DictionaryPage.xaml 的交互逻辑
    /// </summary>
    [Component]
    public partial class DictionaryPage : Page
    {
        private readonly DictionaryInfoViewModel viewModel;
        public DictionaryPage(DictionaryInfoViewModel viewModel)
        {
            this.viewModel = viewModel;
            DataContext = viewModel;
            InitializeComponent();
        }

        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            DictionaryInfo? selector = (DictionaryInfo)e.NewValue;
            if (selector != null)
            {
                viewModel.Query.ParentId = selector?.Id;
                viewModel.GetList();
            }
           
        }
    }
}
